/**
 * MasicSpeaker
 * <p/>
 * User: joakimd
 * Date: 2013-03-11
 * Time: 13:11
 */
package org.dru.masic {
import flash.utils.ByteArray;

public final class MasicSpeaker extends MasicComponent {
    private var _in: MasicInput;

    public function MasicSpeaker() {
        _in = createInput("in", true);
    }

    internal function writeSampleData(data: ByteArray, start: int, end: int): void {
        const left: Vector.<Number> = _in.left;
        const right: Vector.<Number> = _in.right;
        for (var index: int = start; index < end; index++) {
            data.writeFloat(left[index] * 0.2);
            data.writeFloat(right[index] * 0.2);
        }
    }
}
}
